/**
 * 抢兑商品时间列表
 */
function getRobTimeList(success) {
  getApp().func.Post(false, getApp().api.get_rob_time_list,
    function (data) {
      typeof success == "function" && success(data);
    },
    function (res) {
      console.log(res.errMsg);
    })
}

/**
 * 抢兑商品列表
 */
function getRobList(saleType, robType, startPage, time, success) {
  let param = new Object();
  param['saleType'] = saleType;
  param['robType'] = robType;
  param['startPage'] = startPage;
  param['time'] = time;
  getApp().func.Post(false, getApp().api.get_rob_list, param,
    function (data) {
      typeof success == "function" && success(data);
    },
    function (res) {
      console.log(res.errMsg);
    });
}


/**
 * 抢兑一口价商品下单
 */
function putRobBuy(goodsId, receiveAddress, success) {
  let param = new Object();
  param['goodsId'] = goodsId;
  param['receiveAddress'] = receiveAddress;
  getApp().func.Post(false, getApp().api.put_rob_buy, param,
    function (data) {
      typeof success == "function" && success(data);
    },
    function (res) {
      console.log(res.errMsg);
    });
}

module.exports = {
  getRobTimeList: getRobTimeList,
  getRobList: getRobList,
  putRobBuy: putRobBuy
}